package com.jiang.boot;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

//@Controller
@RestController
public class BootApp {

    @RequestMapping("/")
//	@ResponseBody
    public String Hello() {

        return "Hello World!";
    }

    @RequestMapping("/print")
    public void printName(String name) {

        System.out.println("传来的参数是:" + name);
    }

    @RequestMapping(value = "/printMyName/{name}", method = RequestMethod.GET)
    public void printNameRest(@PathVariable("name") String myName) {

        System.out.println(myName);
    }

    @RequestMapping("/printReq")
    public void innerObject(HttpServletRequest request) {

        System.out.println(request.getRemoteHost());
        System.out.println(request.getContentType());
        System.out.println(request.getRequestURI() + "," + request.getRequestURL());
        System.out.println(request.getServletContext().getRealPath("/"));
        System.out.println(request.getSession().getId());
    }


}
